package com.example.mapper;

import com.example.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: bjc
 * Date: 2025-07-12
 * Time: 15:34
 */
@Mapper
public interface MessageInfoMapper {


    /**
     * 插入消息
     * @param messageInfo
     * @return
     */
    @Insert("insert into message_info(`from`,`to`,message) values(#{from},#{to},#{say})")
    Integer insert(MessageInfo messageInfo);

    /**
     * 获取消息列表
     * @return
     */
    @Select("select id,`from`,`to`,message as say from message_info where delete_flag=0")
    List<MessageInfo> getList();
}
